#ifndef TREAD_H
#define TREAD_H
#include "dirdata.h"
#include "widget.h"
#include <QThread>
#include <iostream>
#include <QMutex>
#include <QWaitCondition>
#include <QDir>

class MyThread : public QThread
{
    Q_OBJECT
public:
    MyThread();
    void setLeader(Widget* ptr);
    void run() override;
    void setQueue(QVector<QString>* _queue);
    static void threadWakeOne();
    static void threadWakeAll();
    void setStop();
    void setRun();
    int scanningInitialization();
    void scanning();
    void modelAdd(QFileInfo& tmpfile);
    void setClose();
private:
    DirData _dirfile;
    bool close;
    bool _stop;
    Widget* _leader;
    static QVector<QString>* _queue;
    static QMutex _mtuex;
    static QWaitCondition _cond;
};


#endif // TREAD_H
